rm(list=ls()) #clear

library(dplyr)

load("Study 4 - Bovitz/TS/dataT1.RData")
load("Study 4 - Bovitz/TS/dataT2.RData")
load("Study 4 - Bovitz/TS/dataT3.RData")

colnames(datT3)<- paste(colnames(datT3), "T3", sep = "_")
datT3 <- datT3 %>% dplyr::rename("PID" = "PID_T3")

dat<- merge(datT1, datT2, by = "PID", all = "TRUE", suffixes = c("_T1", "_T2")) %>%
  merge(datT3, by = "PID", all = "TRUE")

dat<- subset(dat, dat$Finished_T1==1)

save(dat, file = "Study 4 - Bovitz/TS/datS4TS.RData")

save(dat, file = "Main Analyses/datS4TS.RData")
